/*
 * File     : WindowsX86_64Platform.java
 * Created  : 16 Apr 2011
 * Revision : $Revision$
 *
 * Copyright © 2006-9 Matthew Wilson (mj. {my-surname} .uk {at} gmail.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.dni.internal.platform;

import java.util.EnumSet;

import com.googlecode.dni.CallingConvention;
import com.googlecode.dni.Padding;
import com.googlecode.dni.internal.call.NativeCallFactory;
import com.googlecode.dni.internal.call.X86_64WindowsNativeCallFactory;
import com.googlecode.dni.platform.WindowsPlatformType;


/**
 * <p>
 *  Implementation of {@link Platform} for Windows x86_64.
 * </p>
 *
 * @author Matthew Wilson
 */
final class WindowsX86_64Platform extends AbstractWindowsPlatform
{

    /**
     * Creates a new instance.
     */
    WindowsX86_64Platform()
    {
        super( WindowsPlatformType.X86_64,
               Padding.FIXED_8,
               EnumSet.of( CallingConvention.X86_64_WINDOWS ),
               CallingConvention.X86_64_WINDOWS );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NativeCallFactory createNativeCallFactory( final CallingConvention callingConvention )
    {
        switch ( callingConvention )
        {
            // everything maps to the same convention on Windows x64, even with
            // the MS C compiler
            case X86_64_WINDOWS:
            case CDECL:
            case STDCALL:
                return new X86_64WindowsNativeCallFactory();

            default:
                throw new UnsupportedOperationException( callingConvention.toString() );
        }
    }

}
